package com.kinggm.service.decorator;

import com.kinggm.service.decorator.abs.Beverage;
import com.kinggm.service.decorator.abs.impl.Espresso;
import com.kinggm.service.decorator.abs.impl.Mocha;
import com.kinggm.service.decorator.abs.impl.Soy;
import com.kinggm.service.decorator.abs.impl.Whip;

public class DecoratorTest {
    public static void main(String[] args) {
        // 加了抹茶的咖啡
        Beverage beverage = new Espresso("大杯");
        beverage = new Mocha(beverage);
        System.out.println(beverage.getDescription() + " $" + beverage.cost());


        // 加了辣椒和糖的咖啡
        Beverage beverage1 = new Espresso("小杯");
        beverage1 = new Soy(beverage1);
        beverage1 = new Whip(beverage1);
        System.out.println(beverage1.getDescription() + " $" + beverage1.cost());

    }



}
